%Scrip to do periodociti analysis with Stefan's data
clear data coeff i L;
Lon_min = 65;
Lon_max = 85;
periods = [2:0.1:150];
lt_min = 7;
lt_max = 15;
 


load c:\manoj\projects\eej\EEJ_Stefan data;
L = data(:,2) > Lon_min & data(:,2) < Lon_max & data(:,12) > lt_min & data(:,12) < lt_max ;
for i = 1:length(periods),
coeff(i,:) = inversion(data(L,1),data(L,6),periods(i));
end;

 load c:\manoj\projects\eej\mjdkpf107 mjd kp;
 load c:\manoj\projects\eej\OBSdH;
 data1(:,1) = mjd;
 %data1(:,2) = reshape(squeeze(OBSdH(2,:,:)-OBSdH(3,:,:))',[1,1096*24]);
 data1(:,2) = reshape(squeeze(OBSdH(2,:,:))',[1,1096*24]);
L = isnan(data1(:,2));
data1(L,:) = [];
for i = 1:length(data1),
[dummy,ett_lt(i)] = champ_lt(data1(i,1),13,78);
end;

L =  ett_lt > lt_min & ett_lt < lt_max ;

for i = 1:length(periods),
coeff1(i,:) = inversion(data1(L,1),data1(L,2),periods(i));
end;

plot(periods,sqrt(coeff(:,2).^2+coeff(:,3).^2),'r',periods,sqrt(coeff1(:,2).^2+coeff1(:,3).^2)/100,'b')
